package com.tjtt.tdm.filemodel.service.impl;

import java.util.List;
import java.util.Map;

import org.hibernate.Query;

import com.tjtt.tdm.base.PageResult;
import com.tjtt.tdm.exception.DaoException;
import com.tjtt.tdm.exception.ServiceException;
import com.tjtt.tdm.filemodel.bean.Filemode;
import com.tjtt.tdm.filemodel.bean.PrintReportMode;
import com.tjtt.tdm.filemodel.bean.TdmCentificatemodeItem;
import com.tjtt.tdm.filemodel.dao.IFilemodeDao;
import com.tjtt.tdm.filemodel.service.IFilemodeService;
import com.tjtt.tdm.form.bean.AutoFormsField;
import com.tjtt.tdm.form.bean.AutoFormsNew;

public class FilemodeServiceImpl implements  IFilemodeService{
    private IFilemodeDao filemodeDao;
	
	public Filemode getFilemodeById(long id) {
		return filemodeDao.getFilemodeById(id);
	}

	
	public PageResult queryFilemodeList(Map filterMap) {
		return filemodeDao.queryFilemodeList(filterMap);
	}

	
	public void save(Object o) throws DaoException {
		// TODO Auto-generated method stub
		filemodeDao.save(o);
	}

	
	public void update(Object o) throws DaoException {
		// TODO Auto-generated method stub
		filemodeDao.update(o);
	}

	public IFilemodeDao getFilemodeDao() {
		return filemodeDao;
	}

	public void setFilemodeDao(IFilemodeDao filemodeDao) {
		this.filemodeDao = filemodeDao;
	}

	
	public void delete(Filemode filemode) throws DaoException {
		// TODO Auto-generated method stub
		filemodeDao.delete(filemode);
	}

	/**
	 * 通过选中节点查询分类信息
	 * @param pId
	 * @param filterMap
	 * @return PageResult
	 * @author 谈泊麟
	 * @date 2013-1-24 下午03:35:12
	 */
	public PageResult getModelByPid(int type, Map<String, String> filterMap)throws ServiceException {
		return this.filemodeDao.getModelByPid(type, filterMap);
	}

	
	public PageResult queryModeItemList(Map<String, String> filterMap) {
		return filemodeDao.queryModeItemList(filterMap);
	}

	public PageResult queryItemList(Map<String, String> filterMap) {
		return filemodeDao.queryItemList(filterMap);
	}
	
	public AutoFormsField findAuToFormsField(Long ids) {
		return filemodeDao.findAuToFormsField(ids);
	}

	
	public AutoFormsNew findAuToFormsNew(Long formsId) {
		return filemodeDao.findAuToFormsNew(formsId);
	}

	
	public PageResult queryCentificateItemList(Map<String, String> filterMap) {
		return filemodeDao.queryCentificateItemList(filterMap);
	}

	
	public PageResult queryPrintReportItemList(Map<String, String> filterMap) {
		return filemodeDao.queryPrintReportItemList(filterMap);
	}
	/**
	 * 
	 *方法描述:查询合格证标签
	 *@author: wangxd
	 *@date: 2013-12-12下午04:54:39
	 *@param id
	 *@return
	 */
	public TdmCentificatemodeItem queryModeItemById(Long id)
	{
		return filemodeDao.queryModeItemById(id);
	}

	
	public PageResult queryJiShuTiaoJianList(Map filterMap) {
		return filemodeDao.queryJiShuTiaoJianList(filterMap);
	}
	public PageResult queryTempletList(Map<String, String> filterMap)
	{
		return filemodeDao.queryTempletList(filterMap);
	}
	public PrintReportMode toUpdateTemplet(Long id)
	{
		return filemodeDao.toUpdateTemplet(id);
	}
	public void deleteTemplet(String ids) {
		String idss[] = ids.split(",");
		for(String id : idss){
			PrintReportMode printReportMode= new PrintReportMode();
			printReportMode.setId((Long.parseLong(id)));
			this.filemodeDao.delete(printReportMode);
		}
	}
	/**
	 * 选择表单列表
	 * @author zhn
	 * @date Dec 2, 2013 5:45:46 PM
	 */
	public PageResult queryFormList(Map<String, String> filterMap) {
		return this.filemodeDao.queryFormList(filterMap);
	}
	public void saveTemplet(PrintReportMode printReportMode)throws ServiceException {
		try {
			this.filemodeDao.save(printReportMode);
		} catch (DaoException e) {
			throw new ServiceException(e.getMessage(),e);
		}
	}
	public void updateTemplet(PrintReportMode printReportMode) throws ServiceException {
	try {
		filemodeDao.update(printReportMode);
	} catch (DaoException e) {
		throw new ServiceException(e.getMessage(),e);
	}
   }
	
	public PageResult queryMergecelllist(Map filterMap){
		return filemodeDao.queryMergecelllist(filterMap);
	}
}
